package com.neuedu.hcp.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.neuedu.hcp.entity.NursingContent;
import com.neuedu.hcp.entity.NursingLevel;
import com.neuedu.hcp.entity.RespPageBean;
import com.neuedu.hcp.mapper.NursingContentMapper;
import com.neuedu.hcp.mapper.NursingLevelMapper;
import com.neuedu.hcp.service.INursingContentService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 第八组
 * @since 2021-04-26
 */
@Service
public class NursingContentServiceImpl extends ServiceImpl<NursingContentMapper, NursingContent> implements INursingContentService {
    @Autowired
    NursingContentMapper nursingContentMapper;
    @Override
    public RespPageBean getcontentListByPage(Integer currentPage, Integer size, NursingContent nursingContent) {
        Page<NursingContent> page = new Page<>(currentPage,size);
        IPage<NursingContent> levelPage =nursingContentMapper.getcontentListByPage(page,nursingContent);
        RespPageBean respPageBean = new RespPageBean(levelPage.getTotal(),levelPage.getRecords());
        return respPageBean;
    }

    @Override
    public int insert(NursingContent nursingContent) {

        return nursingContentMapper.insert(nursingContent);
    }


}
